package org.dallasrowing.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class LogBookEntryTestUtil {

	public static LogBookEntry newInstance(String discriminator) {
		List<Rower> participants = new ArrayList<Rower>();
		participants.add( RowerTestUtil.newRower(0, RowerTestUtil.ROWER_A) );
		participants.add( RowerTestUtil.newRower(1, RowerTestUtil.ROWER_B) );
		return new LogBookEntry( new Date(), BoatTestUtil.newDouble(0, discriminator), participants );
	}

	public static LogBookEntry newDBInstance(int boatId) {
		List<Rower> participants = new ArrayList<Rower>();
		participants.add( RowerTestUtil.newRower(0, RowerTestUtil.ROWER_A) );
		participants.add( RowerTestUtil.newRower(1, RowerTestUtil.ROWER_B) );
		return new LogBookEntry( new Date(), BoatTestUtil.newDBInstance( boatId ), participants );
	}

	public static LogBookEntry newInvalidEntry( Date currentDate ) {
		Boat boat = BoatTestUtil.newDouble(0, "a");
		List<Rower> participants = new ArrayList<Rower>();
		participants.add( RowerTestUtil.newRower(0,"a") );
		participants.add( RowerTestUtil.newRower(1,"b") );
		participants.add( RowerTestUtil.newRower(2,"c") );
		return new LogBookEntry( currentDate, boat , participants  );
	}

	public static final String LOGBOOK_A = "a";

	public static LogBookEntry newClosedDBInstance(int boatId) {
		List<Rower> participants = new ArrayList<Rower>();
		participants.add( RowerTestUtil.newRower(0, RowerTestUtil.ROWER_A) );
		participants.add( RowerTestUtil.newRower(1, RowerTestUtil.ROWER_B) );
		LogBookEntry logBookEntry = new LogBookEntry( new Date(), BoatTestUtil.newDBInstance( boatId ), participants );
		logBookEntry.setEntryCloseDate(new Date());
		logBookEntry.setDistanceRowed(4.0);
		logBookEntry.setComment("a comment");
		return logBookEntry;
	}

}
